package com.wwu.system.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wwu.common.constant.CommConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 系统部门实体
 * 重写有参构造方法RequiredArgsConstructor ，用于根据科室名称查找deptList中的sysDept对象
 * 重写@EqualsAndHashCode(callSuper = false,of = "deptName")方法，用于根据科室名称查找deptList中的sysDept对象
 * @author 一蓑烟雨
 * @date 2021-10-26
 * @version 1.0.0
 */
@Data
@Accessors(chain = true)
@TableName("sys_dept")
@ApiModel(value="SysDept:系统部门实体", description="系统部门实体")
public class SysDept implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "部门编码")
    @TableId(value = "dept_id", type = IdType.AUTO)
    private Integer deptId;

    @ApiModelProperty(value = "部门名称")
    /** 有参构造方法，不能为空 */
    @NonNull
    @TableField("dept_name")
    private String deptName;

    @ApiModelProperty(value = "父编码")
    @TableField("parent_id")
    private String parentId;

    @ApiModelProperty(value = "部门路径")
    @TableField("dep_path")
    private String depPath;

    @ApiModelProperty(value = "排序码")
    @TableField("dept_sort")
    private Integer deptSort;

    @ApiModelProperty(value = "部门负责人")
    @TableField("dept_leader")
    private String deptLeader;

    @ApiModelProperty(value = "部门电话")
    @TableField("dept_phone")
    private String deptPhone;

    @ApiModelProperty(value = "部门邮箱")
    @TableField("dept_emil")
    private String deptEmil;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "是否启用(0:启用；1:作废)")
    @TableField("dept_status")
    private Integer deptStatus;

    @ApiModelProperty(value = "拼音码")
    @TableField("py")
    private String py;

    @ApiModelProperty(value = "五笔码")
    @TableField("wb")
    private String wb;

    @ApiModelProperty(value = "创建时间")
    /** 格式化后台和前端显示样式 */
    @DateTimeFormat(pattern = CommConst.DATE_TIME)
    @JsonFormat(pattern = CommConst.DATE_TIME,timezone = CommConst.TIME_ZONE)
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "创建人")
    @TableField(value = "creator",fill = FieldFill.INSERT)
    private String creator;

    @ApiModelProperty(value = "修改时间")
    /** 格式化后台和前端显示样式 */
    @DateTimeFormat(pattern = CommConst.DATE_TIME)
    @JsonFormat(pattern = CommConst.DATE_TIME,timezone = CommConst.TIME_ZONE)
    @TableField(value = "modify_time",fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime modifyTime;

    @ApiModelProperty(value = "修改人")
    @TableField(value = "modifier",fill = FieldFill.INSERT_UPDATE)
    private String modifier;

    @ApiModelProperty(value = "子部门")
    /** 表中不存在该字段 */
    @TableField(exist = false)
    private List<SysDept> children;;
}